/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mysweethome.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author BKC
 */
@Entity
@Table(name = "PropertyType", catalog = "MySweetHomeDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "PropertyType.findAll", query = "SELECT p FROM PropertyType p"),
    @NamedQuery(name = "PropertyType.findByTypeID", query = "SELECT p FROM PropertyType p WHERE p.typeID = :typeID"),
    @NamedQuery(name = "PropertyType.findByTypeName", query = "SELECT p FROM PropertyType p WHERE p.typeName = :typeName"),
    @NamedQuery(name = "PropertyType.findByDescription", query = "SELECT p FROM PropertyType p WHERE p.description = :description")})
public class PropertyType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "TypeID")
    private Integer typeID;
    @Basic(optional = false)
    @Column(name = "TypeName")
    private String typeName;
    @Column(name = "Description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "propertyType")
    private List<GeneralInfo> generalInfoList;

    public PropertyType() {
    }

    public PropertyType(Integer typeID) {
        this.typeID = typeID;
    }

    public PropertyType(Integer typeID, String typeName) {
        this.typeID = typeID;
        this.typeName = typeName;
    }

    public Integer getTypeID() {
        return typeID;
    }

    public void setTypeID(Integer typeID) {
        this.typeID = typeID;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<GeneralInfo> getGeneralInfoList() {
        return generalInfoList;
    }

    public void setGeneralInfoList(List<GeneralInfo> generalInfoList) {
        this.generalInfoList = generalInfoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (typeID != null ? typeID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PropertyType)) {
            return false;
        }
        PropertyType other = (PropertyType) object;
        if ((this.typeID == null && other.typeID != null) || (this.typeID != null && !this.typeID.equals(other.typeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mysweethome.entities.PropertyType[typeID=" + typeID + "]";
    }

}
